﻿/**
 * 应用树形结构类型的一般规则。
 */
Ext.define('Happy.metadata.rule.TreeNode', {
    extend: 'Happy.metadata.rule.AggregateRoot',
    alias: 'rule.tree-node',
    requires: ['Happy.metadata.EditorConfigFns'],

    /**
     * 应用规则。
     * 
     * @param {Happy.metadata.Metadata} metadata
     */
    applyRule: function (metadata) {
        var me = this;

        me.callParent(arguments);

        me.hidePropertyInAllUI(metadata, 'NodePath');
        me.applyPropertyConfig(metadata, 'ParentId', {
            showInGrid: false,
            showInTreeGrid: false,
            displayName: '父节点',
            foreignReference: {
                metadata: metadata
            },
            editorConfigFns: [
                Happy.metadata.EditorConfigFns.treeComboBoxConfigFn
            ]
        });
    }
});